package com;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;


public class Verify extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    public Verify() {
        super();
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//		String username=request.getParameter("username");
//		String password=request.getParameter("password");
		String checkcode=request.getParameter("checkCode");
		String test=request.getParameter("jack");
		System.out.print(test);
//		PrintWriter out=response.getWriter();
		HttpSession session=request.getSession();
		String r_checkcode=(String)session.getAttribute("randCheckCode");
//		System.out.println("username="+username+" password="+password);
//		System.out.println("checkcode="+checkcode+"r_checkcode="+r_checkcode);
		if("".equals(checkcode)||!checkcode.equals(r_checkcode)){
			request.getRequestDispatcher("index.jsp").forward(request, response);
		}else{
			request.getRequestDispatcher("home.jsp").forward(request, response);
		}
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
